package com.eversec.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by eversec on 2017/7/12.
 */
public class DateUtil {

    private static  final String format = "YYYYMM";

    public static String getNow_YYMM(){

        SimpleDateFormat  f =  new SimpleDateFormat(format);
        return f.format(new Date());
    }

    public static Date getStrToDate(String date ){

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if(date !=null){

            try {
                return sdf.parse(date);
            } catch (ParseException e) {
                e.printStackTrace();
            }
        }
        return null ;

 }

}
